home *** CD-ROM | disk | FTP | other *** search
/ Alles Voor Internet / Tout Pour Internet / alles voor internet.iso / MacInternet™ / Modem / LineShare⁄ZyXEL Folder / ZyXEL Fax&Hermes < prev    next >
Text File  |  1992-12-25  |  6KB  |  311 lines

  1. !
  2. ! LineShare™ Script for ZyXEL U-1496 modems
  3. !
  4. ! If you want to modify this script for your modem, pay attention to
  5. ! the line marked "#### Settings ####" - it should be modified first
  6. ! This script is written to use with the Hermes™ BBS on the "Hermes" subPort:
  7. ! this application sets the modem into the "V0" mode.
  8. ! This script doesn't set the "V0" mode, but instead - translates all CONNECT
  9. ! messages into their numeric values
  10. ! This trick is marked with the "$$$" symbols
  11. !
  12. ! ------------------------------------------
  13. ! Resetting the modem:
  14. ! ------------------------------------------
  15. @Hangup
  16.   SetTries 2
  17.   Flush
  18.   HsReset 0,0,17,19,0,0
  19. !
  20. ! Try to catch the "OK" answer, use the Escape seq and DTR transitions
  21. ! to enter the command mode
  22. !
  23. @Label 1
  24.   matchclr
  25.   matchstr 1 2 "OK\r\n"
  26.   write "ATH0&F\r"
  27.   matchread 20
  28.   Write "+++"
  29.   DtrClear
  30.   pause 10
  31.   DtrSet
  32. !
  33.   DecTries
  34.   IfTries 0 1
  35. !
  36. ! OSErr -6019 "Modem error - the modem is not responding"
  37. !
  38.   exit -6019
  39. @Label 2
  40.   write "AT+FCLASS=0\r"
  41.   Jsr 100
  42.   write "AT+FAA=0\r"
  43.   Jsr 100
  44.   exit 0
  45. ! ------------------------------------------
  46. !    Receiving incoming calls
  47. ! ------------------------------------------
  48. @ANSWER
  49. @Label 10
  50. !
  51. ! Set the modem preferred speed first
  52. !
  53.   SERRESET 2400,0,8,1
  54.   Jsr 80
  55. !
  56. ! Set the common options
  57.   Jsr 70
  58. !
  59. ! Set the communication options:
  60. ! • Extended response set
  61. ! • &K4 - Enable MNP/V42 connections (for Hermes)
  62. ! • &H4 - Xon/Xoff flow control (for Fax)
  63. !
  64. @Label 11
  65. ! #### Settings - change this according to the type of modem you have ####
  66.   Write "ATX4&K4&H4\r"
  67.   Jsr 100
  68. !
  69. ! Set the "work" speed
  70. !
  71. @Label 12
  72.   SERRESET 19200,0,8,1
  73.   Jsr 80
  74. !
  75. ! Set Fax parameters: LID, DCC,BOR
  76. !
  77.   Write "AT+FCLASS=2\r"
  78.   Jsr 100
  79.   Write "AT+FLID=\"Stalker_GmbH\"\r"
  80.   Jsr 100
  81.   Write "AT+FDCC=1,3,0,2,0,0,0,0\r"
  82.   Jsr 100
  83.   Write "AT+FBOR=1\r"
  84.   Jsr 100
  85. !
  86. ! Allow modem to receive fax messages
  87. !
  88.   Write "AT+FCR=1\r"
  89.   Jsr 100
  90. !
  91. ! Tell the modem to determine the type of the incoming call
  92. ! Fetch the tube after N rings, where N has been set in the control panel (^4)
  93. !
  94.   Write "ATS0=^4+FAA=1\r"
  95.   Jsr 100
  96. !
  97. ! Everything is ready - let's sit and wait for a call
  98. ! We'll wait for 2 minutes, then reinitiate the modem
  99. !
  100. @Label 20
  101.   MatchClr
  102.   matchstr 1  20 "RING\r\n"
  103.   matchstr 2  40 "\r\n+FCON"
  104.   matchstr 3  10 "\r\nNO "
  105.   matchstr 4  10 "\r\nBUSY"
  106.   matchstr 5  21 "\r\nCONNECT 1200"
  107.   matchstr 6  22 "\r\nCONNECT 2400"
  108.   matchstr 7  23 "\r\nCONNECT 4800"
  109.   matchstr 8  24 "\r\nCONNECT 7200"
  110.   matchstr 9  25 "\r\nCONNECT 9600"
  111.   matchstr 10 26 "\r\nCONNECT 12000"
  112.   matchstr 11 27 "\r\nCONNECT 14400"
  113.   matchstr 12 28 "\r\nCONNECT 19200"
  114. !
  115.   Matchread 1200
  116.   jump 10
  117. !
  118. ! Data connection has been established (we read "CONNECT")
  119. ! $$$
  120. ! $$$ Put the numeric response back to the buffer and attach the "Data" subPort
  121. ! $$$ Since we didn't use "Adjust BPS", we don't adjust the port speed
  122. ! $$$ (make sure that your BBS is prepeared to work in this mode
  123. @Label 21
  124.   jsr 35
  125.   QueueInput "5\r"
  126.   Jump 30
  127. @Label 22
  128.   jsr 35
  129.   QueueInput "10\r"
  130.   Jump 30
  131. @Label 23
  132.   jsr 35
  133.   QueueInput "11\r"
  134.   Jump 30
  135. @Label 24
  136.   jsr 35
  137.   QueueInput "15\r"
  138.   Jump 30
  139. @Label 25
  140.   jsr 35
  141.   QueueInput "12\r"
  142.   Jump 30
  143. @Label 26
  144.   jsr 35
  145.   QueueInput "16\r"
  146.   Jump 30
  147. @Label 27
  148.   jsr 35
  149.   QueueInput "17\r"
  150.   Jump 30
  151. @Label 28
  152.   jsr 35
  153.   QueueInput "14\r"
  154. @Label 30
  155.   Attach "Hermes" (DTR,BREAK,Escape,IDLELimit=60)
  156. !
  157. ! This routine clears the input buffer (after the CONNECT) till "\r\n"
  158. !
  159. @Label 35
  160.   MatchClr
  161.   MatchStr 1 36 "\r\n"
  162.   MatchRead 10
  163. @Label 36
  164.   return
  165.  
  166. !
  167. ! Fax connection has been established (we read "+FCON")
  168. ! Put the +FCON back to the buffer,
  169. ! if it was an incoming call, put the "RING" before the "+FCON"
  170. ! Attach the "Fax" subPort
  171. !
  172. @Label 40
  173.   QueueInput "\r\n+FCON"
  174.   ifOriginate 41
  175.   QueueInput "\r\nRING\r\n"
  176. @Label 41
  177.   Attach "Fax" (DTR,RESET,ESCAPE,IDLELimit=30)
  178. ! ------------------------------------------
  179. ! Originating a call through the "Hermes" subport
  180. ! ------------------------------------------
  181. @ORIGINATE "Hermes"
  182. !
  183. ! Set the Data speed
  184. !
  185.   SERRESET 2400,0,8,1
  186.   Jsr 80
  187. !
  188. ! Set the common options
  189. !
  190.   Jsr 70
  191. !
  192. ! Set the Data mode
  193. ! S7 is set to 1.5 minute for international calls
  194. ! &S1 should be set if necessary (see above) 
  195. !
  196.   Write "ATS7=90&S1+FCLASS=0\r"
  197.   Jsr 100
  198. !
  199. ! Now emit all commands that the application has sent to that port
  200. !
  201.   Jsr 60
  202. !
  203. ! Prepare to receive all error result codes
  204. !
  205.   Jsr 90
  206.   matchstr 1 21 "\r\nCONNECT"
  207. !
  208. ! Dial the number
  209. !
  210.   HsReset *
  211.   Write "ATD^1\r"
  212.   MatchRead 900
  213.   Write "\r"
  214.   Exit -6019
  215. ! ------------------------------------------
  216. ! Originating a call through the "Fax" subPort
  217. ! ------------------------------------------
  218. @ORIGINATE "Fax"
  219. !
  220. ! Set the "Fax" speed
  221. !
  222.   SERRESET 19200,0,8,1
  223.   Jsr 80
  224. !
  225. ! Set the common options
  226. !
  227.   Jsr 70
  228. !
  229. ! Set the Fax mode
  230. ! &S0: DSR always on (see above)
  231. !
  232.   Write "AT&S0+FCLASS=2\r"
  233.   Jsr 100
  234. !
  235. ! Now emit all commands that the application has sent to that port,
  236. ! Prepare to receive all error result codes
  237. !
  238. @LABEL 50
  239.   Jsr 60
  240.   Jsr 90
  241.   MatchStr 1 40 "\r\n+FCON"
  242.   HsReset *
  243.   Write "ATD^1\r"
  244.   MatchRead 700
  245.   Write "\r"
  246.   Exit -6019
  247. !
  248. ! This section emits all modem commands sent from the client application
  249. ! For each set of commands the "OK" answer is awaited
  250. !
  251. @Label 60
  252.   EmitStart
  253. @Label 61
  254.   EmitCommand 62
  255.   Jsr 100
  256.   Jump 61
  257. @Label 62
  258.   return
  259. !
  260. ! This section initiates the modem before ANSWER and ORIGINATEs:
  261. ! factory settings + speaker control +
  262. ! reset on Dtr drop + DCD valid
  263. ! Verbal responses mode, no echo 
  264. !
  265. @Label 70
  266.   Write "ATM^2L^3&D3&C1V1E0\r"
  267.   Jsr 100
  268.   return 
  269. !
  270. ! This section syncronize the modem after the serial port speed switching
  271. !
  272. @Label 80
  273.   ChrDelay 1
  274.   Write "AT\r"
  275.   ChrDelay 0
  276.   Jsr 100
  277.   return
  278. !
  279. ! Prepare to receive error result codes
  280. !
  281. @Label 90
  282.   MatchClr
  283.   MatchStr 2 91 "NO DIALTONE\r\n"
  284.   MatchStr 3 92 "BUSY\r\n"
  285.   MatchStr 4 93 "NO CARRIER\r\n"
  286.   MatchStr 5 94 "NO ANSWER\r\n"
  287.   return
  288. @Label 91
  289.   exit -6020
  290. @Label 92
  291.   exit -6022
  292. @Label 93
  293.   exit -6021
  294. @Label 94
  295.   exit -6023
  296. !
  297. ! Processing the AT command:
  298. ! OK -> proceed
  299. ! ERROR or TimeOut ->exit -6019
  300. ! It can be called AFTER the "Write" command, since LineShare buffers input
  301. !
  302. @Label 100
  303.   MatchClr
  304.   MatchStr 1 102 "\r\nOK\r\n"
  305.   MatchStr 2 101 "\r\nERROR\r\n"
  306.   MatchRead 20
  307. @Label 101
  308.   Exit -6019
  309. @Label 102
  310.   return
  311.